﻿<!DOCTYPE html>
<html>
<head>
    <title>JS Operators Exercise 7</title>
    <link href="styles/js-console.css" rel="stylesheet" />
</head>
<body>
    <h1>Checks if given positive integer number n (n ≤ 100) is prime:</h1>
    <label for="input-number">Number:</label>
    <input type="number" id="input-number"/>
    <button onclick="checkNumber()">Check Number</button>
    <div id="js-console"></div>
    <script src="scripts/js-console.js"></script>
    <script>
        function checkNumber()
        {
            var num;
            num = jsConsole.readInteger("#input-number");

            if ((1 == num)
                || (2 == num)
                || (3 == num)
                || (5 == num)
                || (7 == num)
                || (11 == num)
                || (13 == num)
                || (17 == num)
                || (19 == num)
                || (23 == num)
                || (29 == num)
                || (31 == num)
                || (37 == num)
                || (41 == num)
                || (43 == num)
                || (47 == num)
                || (53 == num)
                || (59 == num)
                || (61 == num)
                || (67 == num)
                || (71 == num)
                || (73 == num)
                || (79 == num)
                || (83 == num)
                || (89 == num)
                || (97 == num))
            {
                jsConsole.writeLine(num + " is prime");
            }
            else
            {
                jsConsole.writeLine(num + " is NOT prime");
            }
        }
    </script>
</body>
</html>
